package com.deep.spring.stream.io2;

import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;

public class SpelTest {
    public static void main(String[] args) {
//    v1();
//        v2();
        v3();
    }

    public static void v3() {
        //
        ExpressionParser parser = new SpelExpressionParser();
        Expression exp = parser.parseExpression("'hello world'.bytes");
        byte[] bytes = (byte[]) exp.getValue();
        System.out.println(bytes);
        System.out.println(String.valueOf(bytes));
    }


    public static void v2() {
        //
        ExpressionParser parser = new SpelExpressionParser();
        Expression exp = parser.parseExpression("'hello world'.concat('!')");
        String message = (String) exp.getValue();
        System.out.println(message);
    }

    public static void v1() {
        //
        ExpressionParser parser = new SpelExpressionParser();
        Expression exp = parser.parseExpression("'hello world'");
        String message = (String) exp.getValue();
        System.out.println(message);
    }
}
